<?php

/**
* Wards List get
* @author: trungdt
* For HuyBDS project
*/

if (!defined('EXPONENT')) exit('');

	global $db;

    $pid="";
    if (isset($_REQUEST['pid']))
        $pid=_ab_safe_html_string($_REQUEST['pid']);
    // get province ID
    $pro=$db->selectObject('provinces'," short_name='{$pid}' OR id={$pid}");
    if (!$pro)
    {
        die();
    }
	$links = $db->selectObjects('provinces_wards'," pid = {$pro->id}");

	$html="<option value=0 selected>Tất cả</option>";
    foreach ($links as $k=>$v)
    {
        $html.="<option value='{$v->id}'>{$v->name}</option>";
    }
    echo $html;
    return true;
?>